package durst.data.json;

import com.sdicons.json.mapper.JSONMapper;
import com.sdicons.json.mapper.MapperException;
import com.sdicons.json.mapper.helper.SimpleMapperHelper;
import com.sdicons.json.model.JSONBoolean;
import com.sdicons.json.model.JSONObject;
import com.sdicons.json.model.JSONValue;

import durst.data.InvitedEvent;

public class InvitedEventJSONHelper implements SimpleMapperHelper {
	@Override
	public Class<InvitedEvent> getHelpedClass() {
		return InvitedEvent.class;
	}

	@Override
	public JSONValue toJSON(Object aPojo) throws MapperException {
		if (aPojo instanceof InvitedEvent && aPojo != null) {
			InvitedEvent event = (InvitedEvent) aPojo;
			
			JSONObject obj = (JSONObject)JSONMapper.toJSON(event.getEvent());
			obj.getValue().put("invited", new JSONBoolean(true));
			obj.getValue().put("jumplist", new JSONBoolean(event.isJumplisted()));
			return obj;
		}
		return null;
}

	@Override
	public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException {
		// TODO Auto-generated method stub
		return null;
	}
}